Hotfix: gobby-hooks 0.1.1 (Windows extern block requires unsafe in edition 2024)#3
Conversation
…e 0.1.1
ghook 0.1.0 published to crates.io but the Windows build target
failed: edition 2024 requires `extern "system" { ... }` to be
`unsafe extern "system" { ... }`. Local Mac dev never exercised the
#[cfg(windows)] branch in detach.rs so it slipped through.
Fix is one line in crates/ghook/src/detach.rs:36 plus a Cargo.toml
bump to 0.1.1 and a CHANGELOG entry. Linux/Mac use the
#[cfg(unix)] setsid(2) branch and were never affected -- the
crates.io 0.1.0 install works on those platforms but not Windows.
Verified: cargo build/test/clippy clean (27 ghook tests passing).
Once gobby-hooks-v0.1.1 is tagged, the Release ghook workflow
should succeed across all 5 build targets and create the GitHub
Release that 0.1.0 missed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughVersion 0.1.1 release bumps package version and addresses Windows compilation compatibility with Rust Edition 2024 by marking the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Hotfix release for gobby-hooks to restore Windows builds under Rust 2024 edition rules by adjusting the only Windows-only FFI extern block, and bumping the crate to 0.1.1.
Changes:
- Marked the Windows
extern "system"block indetach()asunsafe extern "system"to satisfy Rust 2024 edition requirements. - Bumped
gobby-hooksfrom 0.1.0 → 0.1.1 and updatedCargo.lockaccordingly. - Added a
CHANGELOGentry documenting the Windows build fix.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/ghook/src/detach.rs | Updates the Windows-only FFI extern block to be unsafe under edition 2024. |
| crates/ghook/Cargo.toml | Bumps gobby-hooks version to 0.1.1. |
| Cargo.lock | Regenerates lockfile to reflect the new crate version. |
| CHANGELOG.md | Adds release notes for gobby-hooks 0.1.1 describing the Windows fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| #### gobby-hooks | ||
|
|
||
| - **Windows build** — `crates/ghook/src/detach.rs` declared `extern "system" { fn FreeConsole() -> i32; }` for the Windows-only `FreeConsole()` call. Edition 2024 requires extern blocks to be marked `unsafe`, so the Windows build target failed under Rust 1.95. Mac/Linux unaffected (their `#[cfg(unix)]` path uses `setsid(2)` instead). 0.1.0 published to crates.io but Windows users could not `cargo install gobby-hooks`. (#124) |
There was a problem hiding this comment.
The changelog entry hard-codes that the failure happened under “Rust 1.95”, but this crate (and the workspace) declares rust-version = "1.85" and the repo uses an unpinned stable toolchain (rust-toolchain.toml). To avoid an easily-stale or potentially inconsistent detail, consider phrasing this as “Rust (edition 2024)” or “Rust >= 1.85 / edition 2024” instead of naming a specific compiler version.
| - **Windows build** — `crates/ghook/src/detach.rs` declared `extern "system" { fn FreeConsole() -> i32; }` for the Windows-only `FreeConsole()` call. Edition 2024 requires extern blocks to be marked `unsafe`, so the Windows build target failed under Rust 1.95. Mac/Linux unaffected (their `#[cfg(unix)]` path uses `setsid(2)` instead). 0.1.0 published to crates.io but Windows users could not `cargo install gobby-hooks`. (#124) | |
| - **Windows build** — `crates/ghook/src/detach.rs` declared `extern "system" { fn FreeConsole() -> i32; }` for the Windows-only `FreeConsole()` call. Rust edition 2024 requires extern blocks to be marked `unsafe`, so the Windows build target failed on edition-2024 toolchains. Mac/Linux unaffected (their `#[cfg(unix)]` path uses `setsid(2)` instead). 0.1.0 published to crates.io but Windows users could not `cargo install gobby-hooks`. (#124) |
Summary
Hotfix for
gobby-hooksafter the 0.1.0 release. Bumps to 0.1.1.gobby-hooks 0.1.0published to crates.io fine, but thex86_64-pc-windows-msvcbuild target in the Release ghook workflowfailed because edition 2024 requires
extern "system" { ... }to beunsafe extern "system" { ... }. The#[cfg(windows)]path incrates/ghook/src/detach.rswas the only such block in theworkspace, and Mac/Linux dev never exercised it.
What's in the release
crates/ghook/src/detach.rs:36:unsafe extern "system" { fn FreeConsole() -> i32; }. One-line fix.crates/ghook/Cargo.tomlto 0.1.1,Cargo.lockregenerated.[0.1.1] — gobby-hookssection above[0.1.0].(Branched off current
main, notdev, becausedevstill tracksthe pre-rebase chain from PR #1.)
Test plan
cargo build -p gobby-hookscleancargo test -p gobby-hooks— 27 passingcargo clippy -p gobby-hooks --all-targets -- -D warningsclean~/.gobby/bin/ghookupdated to 0.1.1; compatibility stamp refreshedgobby-hooks-v0.1.1tag: Release ghook workflow succeeds across all 5 build targets and publishes the GitHub Release that 0.1.0 missed🤖 Generated with Claude Code
Summary by CodeRabbit